package day_2022_12_to_3.year2023;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author haomin
 * @date 2023/02/18 22:17
 **/
public class Day2_18_Num1237 {
    class Solution {
        public List<List<Integer>> findSolution(CustomFunction customfunction, int z) {
            List<List<Integer>> list = new ArrayList();
            for (int i = 1; i <= 1000; ++i) {
                for (int j = 1; j <= 1000; ++j) {
                    int res = customfunction.f(i,j);
                    if (res == z) {
                        list.add(Arrays.asList(i, j));
                    } else if (res > z) {
                        break;
                    }
                }
            }

            return  list;
        }
    }
    interface CustomFunction {
        // Returns some positive integer f(x, y) for two positive integers x and y based on a formula.
        int f(int x, int y);
    }
}